package com.service;

import com.service.ITimeTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 *  定时服务类
 */
@Service
public class TimeTaskServiceImpl implements ITimeTaskService {


    @Autowired
    private RedisTemplate redisTemplate;


    @Override
    @Scheduled(cron="0/5 * * * * ?")
    public void removeExcireMailCode() {
        redisTemplate.boundZSetOps("mail").removeRangeByScore(0,System.currentTimeMillis()-30*60*1000);
    }
}
